<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<link rel="stylesheet" type="text/css" href="<%=path %>/easyui/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="<%=path %>/easyui/themes/icon.css">
	<script type="text/javascript" src="<%=path %>/easyui/jquery.min.js"></script>
	<script type="text/javascript" src="<%=path %>/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="<%=path %>/easyui/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="<%=path %>/res/js/CRUD.js"></script>
	
<script type="text/javascript">

function doSearch(){ 
	var cName = $('#courseName').val();
	//alert(cName);
	if(cName == ''){
		$.messager.alert('提示', '请输入查询内容！', 'info');
		//$('#dg').datagrid('load');
	}
    $('#dg').datagrid('load',{  
    	courseName: cName  
    });  
} 	
</script>
</head>
<body >

	<table id="dg" class="easyui-datagrid"
		data-options="url:'<%=path %>/course/all',title:'课程列表',
		fitColumns:true,singleSelect:true,nowrap: false,fit: true,iconCls:'icon-edit',
		idField:'id',singleSelect:true,pagination:true,rownumbers:true,
		frozenColumns:[[{field:'ck',checkbox:true}]],
		toolbar: '#tb'">
		<thead>
			<tr>
				<th data-options="field:'id',width:50,align:'center'">ID</th>
				<th data-options="field:'kcdm',width:100,align:'center'">课程代码</th>
				<th data-options="field:'kczwmc',width:200,align:'center'">课程中文名称</th>
				<th data-options="field:'kcywmc',width:250,align:'center'">课程英文名称</th>
				<th data-options="field:'xf',width:100,align:'center'">学分</th>
				<th data-options="field:'kclb',width:100,align:'center'">课程类别</th>
				<th data-options="field:'khfs',width:100,align:'center'">考核方式</th>
				<th data-options="field:'xkfl',width:150,align:'center'">学科分类</th>
				<th data-options="field:'lrsj',width:100,align:'center'">录入时间</th>
			</tr>
		</thead>
	</table>
	
	<div id="tb">
		<table style="width:100%;cellpadding:0; cellspacing:0">
			<tr>
				<td style="padding-left:2px">
					<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="newObject('#dlg','#fm','添加课程','save')">添加</a>
					<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" onclick="editObject('#dg','#dlg','#fm','编辑课程','save')">编辑</a>
					<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" onclick="removeObject('#dg')">删除</a>
					<shiro:hasRole name="admin">
					<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" onclick="newObject('#generate_dlg','#generate_fm','生成大纲','generate')">生成大纲</a>
					</shiro:hasRole>
				</td>
				<td><div class="pagination-btn-separator"></div></td>
				<td>
					<label for="courseName">课程名称：</label><input type="text" id="courseName">
					<!-- 
					<label for="speaker">主讲人</label><input type="text" name="speaker">
					<label for="coursePlace">课程地点</label><input type="text" name="coursePlace"> -->
					<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',plain:true" onclick="doSearch()">查询</a>
				</td>
			</tr>
		</table>
	</div>
	
	<!-- 表单 start -->
	<div id="dlg" class="easyui-dialog" style="width:400px;height:500px;padding:10px 20px"    
	        data-options="closed:true, buttons:'#dlg-buttons'">   
			<form id="fm" method="post">
				<div><span>课程信息</span></div> 
				<table style="padding-top: 10px;text-align:center;">
					<tr>
						<td>课程中文名称：</td>
						<td><input class="easyui-validatebox" type="text"
							name="kczwmc" data-options="required:true"></input>
							<input type="hidden" name="id" value=""/>	
						</td>
					</tr>
					<tr>
						<td>课程英文名称：</td>
						<td><input class="easyui-validatebox" type="text" name="kcywmc"></input>
						</td>
					</tr>
					<tr>
						<td>课程代码：</td>
						<td><input class="easyui-validatebox" type="text"
							name="kcdm" data-options="required:true"></input></td>
					</tr>
					<tr>
						<td>课程类别：</td>
						<td><input class="easyui-validatebox" type="text" name="kclb"></input></td>
					</tr>
					<tr>
						<td>学分：</td>
						<td><input class="easyui-validatebox" type="text"
							name="xf" data-options="required:true"></input></td>
					</tr>
					<tr>
						<td>考核方式：</td>
						<td><input class="easyui-validatebox" type="text" name="khfs"></input></td>
					</tr>
					<tr>
						<td>开课部门：</td>
						<td><input class="easyui-validatebox" type="text"
							name="kkbmdm" data-options="required:true"></input></td>
					</tr>
					<tr>
						<td>学科分类：</td>
						<td><input class="easyui-validatebox" type="text"
							name="xkfl" data-options="required:true"></input></td>
					</tr>
					<tr>
						<td>课程录入时间</td>
						<td><input class="easyui-datetimebox" type="text"
							name="lrsj" data-options="required:true"></input></td>
					</tr>
					<tr>
						<td>详细：</td>
						<td><textarea name="kcjj" style="height: 80px;"></textarea></td>
					</tr>
				</table>
			</form>
	</div>
	<div id="dlg-buttons">    
	    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" onclick="saveObject('#fm','#dlg','#dg','save')">保存</a>    
	    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="javascript:$('#dlg').dialog('close')">取消</a>    
	</div>  
	<!-- 表单 end -->  
	
	<!-- 生成大纲表单 -->
	<div id="generate_dlg" class="easyui-dialog" style="width:400px;height:300px;padding:10px 20px"    
	        data-options="closed:true, buttons:'#generate_dlg-buttons'">   
			<form id="generate_fm" method="post">
				<div><span>课程信息</span></div> 
				<table style="padding-top: 10px;text-align:center;">
					<tr>
						<td>课程中文名称：</td>
						<td><input class="easyui-validatebox" type="text"
							name="kczwmc"></input>
							<input type="hidden" name="id" value=""/>	
						</td>
					</tr>
					<tr>
						<td>课程代码：</td>
						<td><input class="easyui-validatebox" type="text"
							name="kcdm"></input></td>
					</tr>
					
				</table>
			</form>
	</div>
	<div id="generate_dlg-buttons">    
	    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" onclick="saveObject('#generate_fm','#generate_dlg','#dg','generate')">生成</a>    
	    <shiro:hasRole name="admin">
	    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" onclick="saveObject('#generate_fm','#generate_dlg','#dg','generate')">生成全部</a>    
	    </shiro:hasRole>
	    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="javascript:$('#generate_dlg').dialog('close')">取消</a>    
	</div>  
</body>
</html>